package jpa.entitys.promis.construction;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the GOODS_RECEIVED_NOTE_ITEMS database table.
 * 
 */
@Embeddable
public class GoodsReceivedNoteItemPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(unique=true, nullable=false, length=2)
	private String company;

	@Column(unique=true, nullable=false, length=30)
	private String project;

	@Column(name="GRN_TYPE", unique=true, nullable=false, length=2)
	private String grnType;

	@Column(name="GRN_SERIES", unique=true, nullable=false, length=4)
	private String grnSeries;

	@Column(name="GRN_NO", unique=true, nullable=false, precision=6)
	private long grnNo;

	@Column(name="SEQ_NO", unique=true, nullable=false, precision=3)
	private long seqNo;

    public GoodsReceivedNoteItemPK() {
    }
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getProject() {
		return this.project;
	}
	public void setProject(String project) {
		this.project = project;
	}
	public String getGrnType() {
		return this.grnType;
	}
	public void setGrnType(String grnType) {
		this.grnType = grnType;
	}
	public String getGrnSeries() {
		return this.grnSeries;
	}
	public void setGrnSeries(String grnSeries) {
		this.grnSeries = grnSeries;
	}
	public long getGrnNo() {
		return this.grnNo;
	}
	public void setGrnNo(long grnNo) {
		this.grnNo = grnNo;
	}
	public long getSeqNo() {
		return this.seqNo;
	}
	public void setSeqNo(long seqNo) {
		this.seqNo = seqNo;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof GoodsReceivedNoteItemPK)) {
			return false;
		}
		GoodsReceivedNoteItemPK castOther = (GoodsReceivedNoteItemPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.project.equals(castOther.project)
			&& this.grnType.equals(castOther.grnType)
			&& this.grnSeries.equals(castOther.grnSeries)
			&& (this.grnNo == castOther.grnNo)
			&& (this.seqNo == castOther.seqNo);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.project.hashCode();
		hash = hash * prime + this.grnType.hashCode();
		hash = hash * prime + this.grnSeries.hashCode();
		hash = hash * prime + ((int) (this.grnNo ^ (this.grnNo >>> 32)));
		hash = hash * prime + ((int) (this.seqNo ^ (this.seqNo >>> 32)));
		
		return hash;
    }
}